﻿namespace MelodysDemo.Core.Models
{
    /// <summary>
    /// 班级问卷信息表
    /// </summary>
    [Table("survey_clazz_questionnaire")]
    [Index("ClazzId", Name = "clazz_id")]
    [Index("QuestionnaireId", Name = "questionnaire_id")]
    public partial class SurveyClazzQuestionnaire
    {
        public SurveyClazzQuestionnaire()
        {
            SurveyAnswers = new HashSet<SurveyAnswer>();
        }

        /// <summary>
        /// 自增主键
        /// </summary>
        [Key]
        [Column("id")]
        public long Id { get; set; }
        /// <summary>
        /// 班级ID
        /// </summary>
        [Column("clazz_id")]
        public long ClazzId { get; set; }
        /// <summary>
        /// 问卷ID
        /// </summary>
        [Column("questionnaire_id")]
        public long QuestionnaireId { get; set; }
        /// <summary>
        /// 是否开启IP限制（1：是，0：否）
        /// </summary>
        [Column("is_ip_limit")]
        public byte IsIpLimit { get; set; }
        /// <summary>
        /// 状态（0：待发布，1：已发布，2：已停止）
        /// </summary>
        [Column("status")]
        public byte Status { get; set; }
        /// <summary>
        /// 版本号
        /// </summary>
        [Column("version")]
        public long Version { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        [Column("create_time")]
        public DateTime CreateTime { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        [Required]
        [Column("creator")]
        [StringLength(64)]
        public string Creator { get; set; }
        /// <summary>
        /// 修改时间
        /// </summary>
        [Column("modified_time")]
        public DateTime ModifiedTime { get; set; }
        /// <summary>
        /// 修改人
        /// </summary>
        [Required]
        [Column("modifier")]
        [StringLength(64)]
        public string Modifier { get; set; }
        /// <summary>
        /// 是否删除，0：否，1：是
        /// </summary>
        [Column("is_delete")]
        public byte IsDelete { get; set; }

        [ForeignKey("ClazzId")]
        [InverseProperty("SurveyClazzQuestionnaires")]
        public virtual SurveyClazz Clazz { get; set; }
        [ForeignKey("QuestionnaireId")]
        [InverseProperty("SurveyClazzQuestionnaires")]
        public virtual SurveyQuestionnaire Questionnaire { get; set; }
        [InverseProperty("ClazzQuestionnaire")]
        public virtual ICollection<SurveyAnswer> SurveyAnswers { get; set; }
    }
}